import request from '@/utils/request'

export function getRole(data) {
  return request({
    url: '/role',
    method: 'get',
    params:data,
  })
}

export function getRoleDetail(data) {
  return request({
    url: '/role/' + data,
    method: 'get'
  })
}

export function addRole(data) {
  return request({
    url: '/role',
    method: 'post',
    data
  })
}

export function editRole(data) {
  return request({
    url: '/role/' + data.id,
    method: 'put',
    data
  })
}

export function removeRole(data) {
  return request({
    url: '/role/' + data,
    method: 'delete',
  })
}

// ------------------------------------------

export function getSystemUser(data) {
  return request({
    url: '/sys_user',
    method: 'get',
    params:data,
  })
}

export function getSystemUserDetail(data) {
  return request({
    url: '/sys_user/' + data,
    method: 'get'
  })
}

export function addSystemUser(data) {
  return request({
    url: '/sys_user',
    method: 'post',
    data
  })
}

export function setSystemUserDuty(data) {
  return request({
    url: '/sys_user/set_duty_gate',
    method: 'post',
    data
  })
}

export function editSystemUser(data) {
  return request({
    url: '/sys_user/' + data.id,
    method: 'put',
    data
  })
}

export function deleteSystemUser(data) {
  return request({
    url: '/sys_user/' + data,
    method: 'delete',
  })
}

export function getLoginLog(data) {
  return request({
    url: '/sys_login_record',
    method: 'get',
    params:data,
  })
}

export function getLoginLogDetail(data) {
  return request({
    url: '/sys_login_record/' + data,
    method: 'get'
  })
}

export function addLoginLog(data) {
  return request({
    url: '/sys_login_record',
    method: 'post',
    data
  })
}

export function editLoginLog(data) {
  return request({
    url: '/sys_login_record/' + data.id,
    method: 'put',
    data
  })
}

export function removeLoginLog(data) {
  return request({
    url: '/sys_login_record/' + data,
    method: 'delete',
  })
}

export function getSysLog(data) {
  return request({
    url: '/sys_log',
    method: 'get',
    params:data,
  })
}

export function getSysLogDetail(data) {
  return request({
    url: '/sys_log/' + data,
    method: 'get'
  })
}

export function addSysLog(data) {
  return request({
    url: '/sys_log',
    method: 'post',
    data
  })
}

export function editSysLog(data) {
  return request({
    url: '/sys_log/' + data.id,
    method: 'put',
    data
  })
}

export function removeSysLog(data) {
  return request({
    url: '/sys_log/' + data,
    method: 'delete',
  })
}



export function getSysConfig(data) {
  return request({
    url: '/sys_config',
    method: 'get',
    params:data,
  })
}

export function getSysConfigDetail(data) {
  return request({
    url: '/sys_config/' + data,
    method: 'get'
  })
}

export function addSysConfig(data) {
  return request({
    url: '/sys_config',
    method: 'post',
    data
  })
}

export function editSysConfig(data) {
  return request({
    url: '/sys_config/' + data.id,
    method: 'put',
    data
  })
}

export function removeSysConfig(data) {
  return request({
    url: '/sys_config/' + data,
    method: 'delete',
  })
}

export function getNotice(data) {
  return request({
    url: '/notice',
    method: 'get',
    params:data,
  })
}

export function getNoticeDetail(data) {
  return request({
    url: '/notice/' + data,
    method: 'get'
  })
}

export function addNotice(data) {
  return request({
    url: '/notice',
    method: 'post',
    data
  })
}

export function editNotice(data) {
  return request({
    url: '/notice/' + data.id,
    method: 'put',
    data
  })
}

export function removeNotice(data) {
  return request({
    url: '/notice/' + data,
    method: 'delete',
  })
}


export function getInfo(data) {
  return request({
    url: '/info',
    method: 'get',
    params:data,
  })
}

export function getInfoDetail(data) {
  return request({
    url: '/info/' + data,
    method: 'get'
  })
}

export function addInfo(data) {
  return request({
    url: '/info',
    method: 'post',
    data
  })
}

export function editInfo(data) {
  return request({
    url: '/info/' + data.id,
    method: 'put',
    data
  })
}

export function removeInfo(data) {
  return request({
    url: '/info/' + data,
    method: 'delete',
  })
}



export function getData(uri,data) {
  return request({
    url: '/' + uri,
    method: 'get',
    params:data,
  })
}

export function getDataDetail(uri,data) {
  return request({
    url: '/' + uri + '/' + data,
    method: 'get'
  })
}

export function addData(uri,data) {
  return request({
    url: '/' + uri,
    method: 'post',
    data
  })
}

export function editData(uri,data) {
  return request({
    url: '/' + uri + '/' + data.id,
    method: 'put',
    data
  })
}

export function removeData(uri,data) {
  return request({
    url: '/' + uri + '/' + data.id,
    method: 'delete',
  })
}
